﻿using Abp.Domain.Entities.Auditing;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MyCompanyName.AbpZeroTemplate.Prm.Authorization
{
    public enum ProjectFunctions
    {
        项目新增 = 10,
        项目授权 = 15,
        项目查看 = 20,
        客户查看 = 25,
        项目计划 = 30,
        项目文档 = 40,
        项目文档类型设置 = 45,
        项目文档回收站 = 46,
        项目讨论 = 50,
        项目日志查看 = 55,
        项目进度编辑 = 60,
        项目阶段编辑 = 61,
        项目信息编辑 = 70,
        项目成本编辑 = 80,
        项目成员编辑 = 90,
        项目成员删除 = 100,



        项目问题超级权限 = 110,
        项目问题查看所有 = 120,

        项目问题新增 = 130,
        项目问题关注 = 140,

        项目问题导出 = 150,
        项目问题归档 = 160,





        项目工艺查看 = 200,
        项目工艺新增 = 210,
        项目工艺编辑 = 220,
        项目工艺删除 = 230,
        填写周报 = 240
    }

    public enum DocmentFunctions
    {
        文档查看 = 10,
        文档版本查看 = 20,
        文档编辑 = 30,
        文档删除 = 40,
        文档下载 = 50,
        文档上传 = 60,
        文档定版 = 70,
        文档分享 = 80,
        文档日志查看 = 90
        //回收站 = 70
    }



    #region ProjectRole

    /// <summary>
    /// 项目功能权限
    /// </summary>
    public class ProjectRoleFunctionActions : FullAuditedEntity<int>
    {
        /// <summary>
        /// 项目角色id
        /// </summary>
        public virtual int ProjectRoleId { get; set; }

        public ProjectFunctions Permission { get; set; }
    }


    public class ProjectRoleDocmentActions : FullAuditedEntity<int>
    {
        /// <summary>
        /// 项目角色
        /// </summary>
        public int ProjectRoleId { get; set; }

        /// <summary>
        /// 文档类型
        /// </summary>
        public int DocTypeId { get; set; }

        public DocmentFunctions Permission { get; set; }
    }

    #endregion


    #region SystemRole

    public class SystemRoleFunctionActions : FullAuditedEntity<int>
    {
        /// <summary>
        /// 系统角色
        /// </summary>
        public virtual int SystemRoleId { get; set; }

        public ProjectFunctions Permission { get; set; }
        /// <summary>
        /// 角色的项目可见范围
        /// </summary>
        public virtual ActionScope ProjectScope { get; set; }
    }

    /// <summary>
    /// 系统角色文档权限
    /// </summary>
    public class SystemRoleDocmentActions : FullAuditedEntity<int>
    {
        /// <summary>
        /// 系统角色
        /// </summary>
        public int SystemRoleId { get; set; }
        public int DocTypeId { get; set; }

        /// <summary>
        /// 系统角色的 项目授权范围 通过 项目继承过来。
        /// </summary>
        public DocmentFunctions Permission { get; set; }
    }

    #endregion


    /// <summary>
    /// 操作范围--系统角色对项目的可见范围
    /// </summary>
    public enum ActionScope
    {
        /// <summary>
        /// 无  默认值
        /// </summary>
        Null = 0,

        /// <summary>
        /// 所有
        /// </summary>
        all = 99,

        /// <summary>
        /// Business Unit,事业部
        /// </summary>
        business = 77,

        /// <summary>
        /// 研发中心
        /// </summary>
        center = 22,

        ///// <summary>
        ///// 研究室
        ///// </summary>
        room = 11,

    }





}
